<?php
	class CTRLData  extends XController 
	{
		public function commit()
		{
			$request = XAjax::get();

			// var_dump($request);
			// TODO: User auth here.
			// $user = new PrivilegeVerifier();
			// $user->ensurePrivilege();

			DeviceModel::saveData($request);
		}

		public function upload()
		{
			// TODO: User auth here.
			// $user = new PrivilegeVerifier();
			// $user->ensurePrivilege();

			// TODO: Where to store the files? 
			// Test code for Ruby uploader...
			$saveDst = 'C:\\Users\\HealerKx\\Projects\\nuclide-center\\Scada.Center.Web';

			if (!$_FILES['file']['error']) {
				$fileName = $saveDst . '\\' . $_FILES['file']['name'];
				move_uploaded_file($_FILES['file']['tmp_name'], $fileName);
			}

		}
	}
?>